#!/usr/bin/env python
# -*- coding: utf-8 -*- 

#
# Generated Tue Mar 20 05:27:18 2012 by generateDS.py version 2.7b.
#

import sys
import getopt
import re as re_

etree_ = None
Verbose_import_ = False
(   XMLParser_import_none, XMLParser_import_lxml,
    XMLParser_import_elementtree
    ) = range(3)
XMLParser_import_library = None
try:
    # lxml
    from lxml import etree as etree_
    XMLParser_import_library = XMLParser_import_lxml
    if Verbose_import_:
        print("running with lxml.etree")
except ImportError:
    try:
        # cElementTree from Python 2.5+
        import xml.etree.cElementTree as etree_
        XMLParser_import_library = XMLParser_import_elementtree
        if Verbose_import_:
            print("running with cElementTree on Python 2.5+")
    except ImportError:
        try:
            # ElementTree from Python 2.5+
            import xml.etree.ElementTree as etree_
            XMLParser_import_library = XMLParser_import_elementtree
            if Verbose_import_:
                print("running with ElementTree on Python 2.5+")
        except ImportError:
            try:
                # normal cElementTree install
                import cElementTree as etree_
                XMLParser_import_library = XMLParser_import_elementtree
                if Verbose_import_:
                    print("running with cElementTree")
            except ImportError:
                try:
                    # normal ElementTree install
                    import elementtree.ElementTree as etree_
                    XMLParser_import_library = XMLParser_import_elementtree
                    if Verbose_import_:
                        print("running with ElementTree")
                except ImportError:
                    raise ImportError("Failed to import ElementTree from any known place")

def parsexml_(*args, **kwargs):
    if (XMLParser_import_library == XMLParser_import_lxml and
        'parser' not in kwargs):
        # Use the lxml ElementTree compatible parser so that, e.g.,
        #   we ignore comments.
        kwargs['parser'] = etree_.ETCompatXMLParser()
    doc = etree_.parse(*args, **kwargs)
    return doc

#
# User methods
#
# Calls to the methods in these classes are generated by generateDS.py.
# You can replace these methods by re-implementing the following class
#   in a module named generatedssuper.py.

try:
    from generatedssuper import GeneratedsSuper
except ImportError, exp:

    class GeneratedsSuper(object):
        def gds_format_string(self, input_data, input_name=''):
            return input_data
        def gds_validate_string(self, input_data, node, input_name=''):
            return input_data
        def gds_format_integer(self, input_data, input_name=''):
            return '%d' % input_data
        def gds_validate_integer(self, input_data, node, input_name=''):
            return input_data
        def gds_format_integer_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_integer_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of integers')
            return input_data
        def gds_format_float(self, input_data, input_name=''):
            return '%f' % input_data
        def gds_validate_float(self, input_data, node, input_name=''):
            return input_data
        def gds_format_float_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_float_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of floats')
            return input_data
        def gds_format_double(self, input_data, input_name=''):
            return '%e' % input_data
        def gds_validate_double(self, input_data, node, input_name=''):
            return input_data
        def gds_format_double_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_double_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                try:
                    fvalue = float(value)
                except (TypeError, ValueError), exp:
                    raise_parse_error(node, 'Requires sequence of doubles')
            return input_data
        def gds_format_boolean(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_boolean(self, input_data, node, input_name=''):
            return input_data
        def gds_format_boolean_list(self, input_data, input_name=''):
            return '%s' % input_data
        def gds_validate_boolean_list(self, input_data, node, input_name=''):
            values = input_data.split()
            for value in values:
                if value not in ('true', '1', 'false', '0', ):
                    raise_parse_error(node, 'Requires sequence of booleans ("true", "1", "false", "0")')
            return input_data
        def gds_str_lower(self, instring):
            return instring.lower()
        def get_path_(self, node):
            path_list = []
            self.get_path_list_(node, path_list)
            path_list.reverse()
            path = '/'.join(path_list)
            return path
        Tag_strip_pattern_ = re_.compile(r'\{.*\}')
        def get_path_list_(self, node, path_list):
            if node is None:
                return
            tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag)
            if tag:
                path_list.append(tag)
            self.get_path_list_(node.getparent(), path_list)
        def get_class_obj_(self, node, default_class=None):
            class_obj1 = default_class
            if 'xsi' in node.nsmap:
                classname = node.get('{%s}type' % node.nsmap['xsi'])
                if classname is not None:
                    names = classname.split(':')
                    if len(names) == 2:
                        classname = names[1]
                    class_obj2 = globals().get(classname)
                    if class_obj2 is not None:
                        class_obj1 = class_obj2
            return class_obj1
        def gds_build_any(self, node, type_name=None):
            return None


#
# If you have installed IPython you can uncomment and use the following.
# IPython is available from http://ipython.scipy.org/.
#

## from IPython.Shell import IPShellEmbed
## args = ''
## ipshell = IPShellEmbed(args,
##     banner = 'Dropping into IPython',
##     exit_msg = 'Leaving Interpreter, back to program.')

# Then use the following line where and when you want to drop into the
# IPython shell:
#    ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')

#
# Globals
#

ExternalEncoding = 'ascii'
Tag_pattern_ = re_.compile(r'({.*})?(.*)')
String_cleanup_pat_ = re_.compile(r"[\n\r\s]+")
Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)')

#
# Support/utility functions.
#

def showIndent(outfile, level):
    for idx in range(level):
        outfile.write('    ')

def quote_xml(inStr):
    if not inStr:
        return ''
    s1 = (isinstance(inStr, basestring) and inStr or
          '%s' % inStr)
    s1 = s1.replace('&', '&amp;')
    s1 = s1.replace('<', '&lt;')
    s1 = s1.replace('>', '&gt;')
    return s1

def quote_attrib(inStr):
    s1 = (isinstance(inStr, basestring) and inStr or
          '%s' % inStr)
    s1 = s1.replace('&', '&amp;')
    s1 = s1.replace('<', '&lt;')
    s1 = s1.replace('>', '&gt;')
    if '"' in s1:
        if "'" in s1:
            s1 = '"%s"' % s1.replace('"', "&quot;")
        else:
            s1 = "'%s'" % s1
    else:
        s1 = '"%s"' % s1
    return s1

def quote_python(inStr):
    s1 = inStr
    if s1.find("'") == -1:
        if s1.find('\n') == -1:
            return "'%s'" % s1
        else:
            return "'''%s'''" % s1
    else:
        if s1.find('"') != -1:
            s1 = s1.replace('"', '\\"')
        if s1.find('\n') == -1:
            return '"%s"' % s1
        else:
            return '"""%s"""' % s1

def get_all_text_(node):
    if node.text is not None:
        text = node.text
    else:
        text = ''
    for child in node:
        if child.tail is not None:
            text += child.tail
    return text

def find_attr_value_(attr_name, node):
    attrs = node.attrib
    attr_parts = attr_name.split(':')
    value = None
    if len(attr_parts) == 1:
        value = attrs.get(attr_name)
    elif len(attr_parts) == 2:
        prefix, name = attr_parts
        namespace = node.nsmap.get(prefix)
        if namespace is not None:
            value = attrs.get('{%s}%s' % (namespace, name, ))
    return value


class GDSParseError(Exception):
    pass

def raise_parse_error(node, msg):
    if XMLParser_import_library == XMLParser_import_lxml:
        msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, )
    else:
        msg = '%s (element %s)' % (msg, node.tag, )
    raise GDSParseError(msg)


class MixedContainer:
    # Constants for category:
    CategoryNone = 0
    CategoryText = 1
    CategorySimple = 2
    CategoryComplex = 3
    # Constants for content_type:
    TypeNone = 0
    TypeText = 1
    TypeString = 2
    TypeInteger = 3
    TypeFloat = 4
    TypeDecimal = 5
    TypeDouble = 6
    TypeBoolean = 7
    def __init__(self, category, content_type, name, value):
        self.category = category
        self.content_type = content_type
        self.name = name
        self.value = value
    def getCategory(self):
        return self.category
    def getContenttype(self, content_type):
        return self.content_type
    def getValue(self):
        return self.value
    def getName(self):
        return self.name
    def export(self, outfile, level, name, namespace):
        if self.category == MixedContainer.CategoryText:
            # Prevent exporting empty content as empty lines.
            if self.value.strip(): 
                outfile.write(self.value)
        elif self.category == MixedContainer.CategorySimple:
            self.exportSimple(outfile, level, name)
        else:    # category == MixedContainer.CategoryComplex
            self.value.export(outfile, level, namespace,name)
    def exportSimple(self, outfile, level, name):
        if self.content_type == MixedContainer.TypeString:
            outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeInteger or \
                self.content_type == MixedContainer.TypeBoolean:
            outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeFloat or \
                self.content_type == MixedContainer.TypeDecimal:
            outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
        elif self.content_type == MixedContainer.TypeDouble:
            outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
    def exportLiteral(self, outfile, level, name):
        if self.category == MixedContainer.CategoryText:
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \
                (self.category, self.content_type, self.name, self.value))
        elif self.category == MixedContainer.CategorySimple:
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \
                (self.category, self.content_type, self.name, self.value))
        else:    # category == MixedContainer.CategoryComplex
            showIndent(outfile, level)
            outfile.write('model_.MixedContainer(%d, %d, "%s",\n' % \
                (self.category, self.content_type, self.name,))
            self.value.exportLiteral(outfile, level + 1)
            showIndent(outfile, level)
            outfile.write(')\n')


class MemberSpec_(object):
    def __init__(self, name='', data_type='', container=0):
        self.name = name
        self.data_type = data_type
        self.container = container
    def set_name(self, name): self.name = name
    def get_name(self): return self.name
    def set_data_type(self, data_type): self.data_type = data_type
    def get_data_type_chain(self): return self.data_type
    def get_data_type(self):
        if isinstance(self.data_type, list):
            if len(self.data_type) > 0:
                return self.data_type[-1]
            else:
                return 'xs:string'
        else:
            return self.data_type
    def set_container(self, container): self.container = container
    def get_container(self): return self.container

def _cast(typ, value):
    if typ is None or value is None:
        return value
    return typ(value)

#
# Data representation classes.
#

class SerialisationFlags(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, serialisationFlag=None):
        if serialisationFlag is None:
            self.serialisationFlag = []
        else:
            self.serialisationFlag = serialisationFlag
    def factory(*args_, **kwargs_):
        if SerialisationFlags.subclass:
            return SerialisationFlags.subclass(*args_, **kwargs_)
        else:
            return SerialisationFlags(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_serialisationFlag(self): return self.serialisationFlag
    def set_serialisationFlag(self, serialisationFlag): self.serialisationFlag = serialisationFlag
    def add_serialisationFlag(self, value): self.serialisationFlag.append(value)
    def insert_serialisationFlag(self, index, value): self.serialisationFlag[index] = value
    def export(self, outfile, level, namespace_='', name_='SerialisationFlags', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='SerialisationFlags')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='SerialisationFlags'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='SerialisationFlags', fromsubclass_=False):
        for serialisationFlag_ in self.serialisationFlag:
            showIndent(outfile, level)
            outfile.write('<%sserialisationFlag>%s</%sserialisationFlag>\n' % (namespace_, self.gds_format_string(quote_xml(serialisationFlag_).encode(ExternalEncoding), input_name='serialisationFlag'), namespace_))
    def hasContent_(self):
        if (
            self.serialisationFlag
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='SerialisationFlags'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('serialisationFlag=[\n')
        level += 1
        for serialisationFlag_ in self.serialisationFlag:
            showIndent(outfile, level)
            outfile.write('%s,\n' % quote_python(serialisationFlag_).encode(ExternalEncoding))
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'serialisationFlag':
            serialisationFlag_ = child_.text
            serialisationFlag_ = self.gds_validate_string(serialisationFlag_, node, 'serialisationFlag')
            self.serialisationFlag.append(serialisationFlag_)
# end class SerialisationFlags


class UDBType(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, typeName=None, sendFunction=None, setFunction=None, mavlinkType=None):
        self.typeName = typeName
        self.sendFunction = sendFunction
        self.setFunction = setFunction
        self.mavlinkType = mavlinkType
    def factory(*args_, **kwargs_):
        if UDBType.subclass:
            return UDBType.subclass(*args_, **kwargs_)
        else:
            return UDBType(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_typeName(self): return self.typeName
    def set_typeName(self, typeName): self.typeName = typeName
    def get_sendFunction(self): return self.sendFunction
    def set_sendFunction(self, sendFunction): self.sendFunction = sendFunction
    def get_setFunction(self): return self.setFunction
    def set_setFunction(self, setFunction): self.setFunction = setFunction
    def get_mavlinkType(self): return self.mavlinkType
    def set_mavlinkType(self, mavlinkType): self.mavlinkType = mavlinkType
    def export(self, outfile, level, namespace_='', name_='UDBType', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='UDBType')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UDBType'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='UDBType', fromsubclass_=False):
        if self.typeName is not None:
            showIndent(outfile, level)
            outfile.write('<%stypeName>%s</%stypeName>\n' % (namespace_, self.gds_format_string(quote_xml(self.typeName).encode(ExternalEncoding), input_name='typeName'), namespace_))
        if self.sendFunction is not None:
            showIndent(outfile, level)
            outfile.write('<%ssendFunction>%s</%ssendFunction>\n' % (namespace_, self.gds_format_string(quote_xml(self.sendFunction).encode(ExternalEncoding), input_name='sendFunction'), namespace_))
        if self.setFunction is not None:
            showIndent(outfile, level)
            outfile.write('<%ssetFunction>%s</%ssetFunction>\n' % (namespace_, self.gds_format_string(quote_xml(self.setFunction).encode(ExternalEncoding), input_name='setFunction'), namespace_))
        if self.mavlinkType is not None:
            showIndent(outfile, level)
            outfile.write('<%smavlinkType>%s</%smavlinkType>\n' % (namespace_, self.gds_format_string(quote_xml(self.mavlinkType).encode(ExternalEncoding), input_name='mavlinkType'), namespace_))
    def hasContent_(self):
        if (
            self.typeName is not None or
            self.sendFunction is not None or
            self.setFunction is not None or
            self.mavlinkType is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='UDBType'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.typeName is not None:
            showIndent(outfile, level)
            outfile.write('typeName=%s,\n' % quote_python(self.typeName).encode(ExternalEncoding))
        if self.sendFunction is not None:
            showIndent(outfile, level)
            outfile.write('sendFunction=%s,\n' % quote_python(self.sendFunction).encode(ExternalEncoding))
        if self.setFunction is not None:
            showIndent(outfile, level)
            outfile.write('setFunction=%s,\n' % quote_python(self.setFunction).encode(ExternalEncoding))
        if self.mavlinkType is not None:
            showIndent(outfile, level)
            outfile.write('mavlinkType=%s,\n' % quote_python(self.mavlinkType).encode(ExternalEncoding))
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'typeName':
            typeName_ = child_.text
            typeName_ = self.gds_validate_string(typeName_, node, 'typeName')
            self.typeName = typeName_
        elif nodeName_ == 'sendFunction':
            sendFunction_ = child_.text
            sendFunction_ = self.gds_validate_string(sendFunction_, node, 'sendFunction')
            self.sendFunction = sendFunction_
        elif nodeName_ == 'setFunction':
            setFunction_ = child_.text
            setFunction_ = self.gds_validate_string(setFunction_, node, 'setFunction')
            self.setFunction = setFunction_
        elif nodeName_ == 'mavlinkType':
            mavlinkType_ = child_.text
            mavlinkType_ = self.gds_validate_string(mavlinkType_, node, 'mavlinkType')
            self.mavlinkType = mavlinkType_
# end class UDBType


class UDBTypes(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, udbType=None):
        if udbType is None:
            self.udbType = []
        else:
            self.udbType = udbType
    def factory(*args_, **kwargs_):
        if UDBTypes.subclass:
            return UDBTypes.subclass(*args_, **kwargs_)
        else:
            return UDBTypes(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_udbType(self): return self.udbType
    def set_udbType(self, udbType): self.udbType = udbType
    def add_udbType(self, value): self.udbType.append(value)
    def insert_udbType(self, index, value): self.udbType[index] = value
    def export(self, outfile, level, namespace_='', name_='UDBTypes', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='UDBTypes')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='UDBTypes'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='UDBTypes', fromsubclass_=False):
        for udbType_ in self.udbType:
            udbType_.export(outfile, level, namespace_, name_='udbType')
    def hasContent_(self):
        if (
            self.udbType
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='UDBTypes'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('udbType=[\n')
        level += 1
        for udbType_ in self.udbType:
            showIndent(outfile, level)
            outfile.write('model_.UDBType(\n')
            udbType_.exportLiteral(outfile, level, name_='UDBType')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'udbType':
            obj_ = UDBType.factory()
            obj_.build(child_)
            self.udbType.append(obj_)
# end class UDBTypes


class Parameter(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, parameterName=None, udb_param_type=None, variable_name='NULL', description='no description', min='0.0', max='0.0', readonly=True):
        self.parameterName = parameterName
        self.udb_param_type = udb_param_type
        self.variable_name = variable_name
        self.description = description
        self.min = min
        self.max = max
        self.readonly = readonly
    def factory(*args_, **kwargs_):
        if Parameter.subclass:
            return Parameter.subclass(*args_, **kwargs_)
        else:
            return Parameter(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_parameterName(self): return self.parameterName
    def set_parameterName(self, parameterName): self.parameterName = parameterName
    def validate_ParamIdentifier(self, value):
        # Validate type ParamIdentifier, a restriction on xs:string.
        pass
    def get_udb_param_type(self): return self.udb_param_type
    def set_udb_param_type(self, udb_param_type): self.udb_param_type = udb_param_type
    def get_variable_name(self): return self.variable_name
    def set_variable_name(self, variable_name): self.variable_name = variable_name
    def get_description(self): return self.description
    def set_description(self, description): self.description = description
    def get_min(self): return self.min
    def set_min(self, min): self.min = min
    def get_max(self): return self.max
    def set_max(self, max): self.max = max
    def get_readonly(self): return self.readonly
    def set_readonly(self, readonly): self.readonly = readonly
    def export(self, outfile, level, namespace_='', name_='Parameter', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='Parameter')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Parameter'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='Parameter', fromsubclass_=False):
        if self.parameterName is not None:
            showIndent(outfile, level)
            outfile.write('<%sparameterName>%s</%sparameterName>\n' % (namespace_, self.gds_format_string(quote_xml(self.parameterName).encode(ExternalEncoding), input_name='parameterName'), namespace_))
        if self.udb_param_type is not None:
            showIndent(outfile, level)
            outfile.write('<%sudb_param_type>%s</%sudb_param_type>\n' % (namespace_, self.gds_format_string(quote_xml(self.udb_param_type).encode(ExternalEncoding), input_name='udb_param_type'), namespace_))
        if self.variable_name is not None:
            showIndent(outfile, level)
            outfile.write('<%svariable_name>%s</%svariable_name>\n' % (namespace_, self.gds_format_string(quote_xml(self.variable_name).encode(ExternalEncoding), input_name='variable_name'), namespace_))
        if self.description is not None:
            showIndent(outfile, level)
            outfile.write('<%sdescription>%s</%sdescription>\n' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_))
        if self.min is not None:
            showIndent(outfile, level)
            outfile.write('<%smin>%s</%smin>\n' % (namespace_, self.gds_format_string(quote_xml(self.min).encode(ExternalEncoding), input_name='min'), namespace_))
        if self.max is not None:
            showIndent(outfile, level)
            outfile.write('<%smax>%s</%smax>\n' % (namespace_, self.gds_format_string(quote_xml(self.max).encode(ExternalEncoding), input_name='max'), namespace_))
        if self.readonly is not None:
            showIndent(outfile, level)
            outfile.write('<%sreadonly>%s</%sreadonly>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.readonly)), input_name='readonly'), namespace_))
    def hasContent_(self):
        if (
            self.parameterName is not None or
            self.udb_param_type is not None or
            self.variable_name is not None or
            self.description is not None or
            self.min is not None or
            self.max is not None or
            self.readonly is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='Parameter'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.parameterName is not None:
            showIndent(outfile, level)
            outfile.write('parameterName=%s,\n' % quote_python(self.parameterName).encode(ExternalEncoding))
        if self.udb_param_type is not None:
            showIndent(outfile, level)
            outfile.write('udb_param_type=%s,\n' % quote_python(self.udb_param_type).encode(ExternalEncoding))
        if self.variable_name is not None:
            showIndent(outfile, level)
            outfile.write('variable_name=%s,\n' % quote_python(self.variable_name).encode(ExternalEncoding))
        if self.description is not None:
            showIndent(outfile, level)
            outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding))
        if self.min is not None:
            showIndent(outfile, level)
            outfile.write('min=%s,\n' % quote_python(self.min).encode(ExternalEncoding))
        if self.max is not None:
            showIndent(outfile, level)
            outfile.write('max=%s,\n' % quote_python(self.max).encode(ExternalEncoding))
        if self.readonly is not None:
            showIndent(outfile, level)
            outfile.write('readonly=%s,\n' % self.readonly)
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'parameterName':
            parameterName_ = child_.text
            parameterName_ = self.gds_validate_string(parameterName_, node, 'parameterName')
            self.parameterName = parameterName_
            self.validate_ParamIdentifier(self.parameterName)    # validate type ParamIdentifier
        elif nodeName_ == 'udb_param_type':
            udb_param_type_ = child_.text
            udb_param_type_ = self.gds_validate_string(udb_param_type_, node, 'udb_param_type')
            self.udb_param_type = udb_param_type_
        elif nodeName_ == 'variable_name':
            variable_name_ = child_.text
            variable_name_ = self.gds_validate_string(variable_name_, node, 'variable_name')
            self.variable_name = variable_name_
        elif nodeName_ == 'description':
            description_ = child_.text
            description_ = self.gds_validate_string(description_, node, 'description')
            self.description = description_
        elif nodeName_ == 'min':
            min_ = child_.text
            min_ = self.gds_validate_string(min_, node, 'min')
            self.min = min_
        elif nodeName_ == 'max':
            max_ = child_.text
            max_ = self.gds_validate_string(max_, node, 'max')
            self.max = max_
        elif nodeName_ == 'readonly':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'readonly')
            self.readonly = ival_
# end class Parameter


class Parameters(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, parameter=None):
        if parameter is None:
            self.parameter = []
        else:
            self.parameter = parameter
    def factory(*args_, **kwargs_):
        if Parameters.subclass:
            return Parameters.subclass(*args_, **kwargs_)
        else:
            return Parameters(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_parameter(self): return self.parameter
    def set_parameter(self, parameter): self.parameter = parameter
    def add_parameter(self, value): self.parameter.append(value)
    def insert_parameter(self, index, value): self.parameter[index] = value
    def export(self, outfile, level, namespace_='', name_='Parameters', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='Parameters')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Parameters'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='Parameters', fromsubclass_=False):
        for parameter_ in self.parameter:
            parameter_.export(outfile, level, namespace_, name_='parameter')
    def hasContent_(self):
        if (
            self.parameter
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='Parameters'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('parameter=[\n')
        level += 1
        for parameter_ in self.parameter:
            showIndent(outfile, level)
            outfile.write('model_.Parameter(\n')
            parameter_.exportLiteral(outfile, level, name_='Parameter')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'parameter':
            obj_ = Parameter.factory()
            obj_.build(child_)
            self.parameter.append(obj_)
# end class Parameters


class ParameterBlock(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, blockName=None, storage_area='None', serialisationFlags=None, externs=None, load_callback=None, in_mavlink_parameters=None, parameters=None, description='no description'):
        self.blockName = blockName
        self.storage_area = storage_area
        self.serialisationFlags = serialisationFlags
        self.externs = externs
        self.load_callback = load_callback
        self.in_mavlink_parameters = in_mavlink_parameters
        self.parameters = parameters
        self.description = description
    def factory(*args_, **kwargs_):
        if ParameterBlock.subclass:
            return ParameterBlock.subclass(*args_, **kwargs_)
        else:
            return ParameterBlock(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_blockName(self): return self.blockName
    def set_blockName(self, blockName): self.blockName = blockName
    def get_storage_area(self): return self.storage_area
    def set_storage_area(self, storage_area): self.storage_area = storage_area
    def get_serialisationFlags(self): return self.serialisationFlags
    def set_serialisationFlags(self, serialisationFlags): self.serialisationFlags = serialisationFlags
    def get_externs(self): return self.externs
    def set_externs(self, externs): self.externs = externs
    def get_load_callback(self): return self.load_callback
    def set_load_callback(self, load_callback): self.load_callback = load_callback
    def get_in_mavlink_parameters(self): return self.in_mavlink_parameters
    def set_in_mavlink_parameters(self, in_mavlink_parameters): self.in_mavlink_parameters = in_mavlink_parameters
    def get_parameters(self): return self.parameters
    def set_parameters(self, parameters): self.parameters = parameters
    def get_description(self): return self.description
    def set_description(self, description): self.description = description
    def export(self, outfile, level, namespace_='', name_='ParameterBlock', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='ParameterBlock')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ParameterBlock'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='ParameterBlock', fromsubclass_=False):
        if self.blockName is not None:
            showIndent(outfile, level)
            outfile.write('<%sblockName>%s</%sblockName>\n' % (namespace_, self.gds_format_string(quote_xml(self.blockName).encode(ExternalEncoding), input_name='blockName'), namespace_))
        if self.storage_area is not None:
            showIndent(outfile, level)
            outfile.write('<%sstorage_area>%s</%sstorage_area>\n' % (namespace_, self.gds_format_string(quote_xml(self.storage_area).encode(ExternalEncoding), input_name='storage_area'), namespace_))
        if self.serialisationFlags is not None:
            self.serialisationFlags.export(outfile, level, namespace_, name_='serialisationFlags', )
        if self.externs is not None:
            self.externs.export(outfile, level, namespace_, name_='externs')
        if self.load_callback is not None:
            showIndent(outfile, level)
            outfile.write('<%sload_callback>%s</%sload_callback>\n' % (namespace_, self.gds_format_string(quote_xml(self.load_callback).encode(ExternalEncoding), input_name='load_callback'), namespace_))
        if self.in_mavlink_parameters is not None:
            showIndent(outfile, level)
            outfile.write('<%sin_mavlink_parameters>%s</%sin_mavlink_parameters>\n' % (namespace_, self.gds_format_boolean(self.gds_str_lower(str(self.in_mavlink_parameters)), input_name='in_mavlink_parameters'), namespace_))
        if self.parameters is not None:
            self.parameters.export(outfile, level, namespace_, name_='parameters', )
        if self.description is not None:
            showIndent(outfile, level)
            outfile.write('<%sdescription>%s</%sdescription>\n' % (namespace_, self.gds_format_string(quote_xml(self.description).encode(ExternalEncoding), input_name='description'), namespace_))
    def hasContent_(self):
        if (
            self.blockName is not None or
            self.storage_area is not None or
            self.serialisationFlags is not None or
            self.externs is not None or
            self.load_callback is not None or
            self.in_mavlink_parameters is not None or
            self.parameters is not None or
            self.description is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='ParameterBlock'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.blockName is not None:
            showIndent(outfile, level)
            outfile.write('blockName=%s,\n' % quote_python(self.blockName).encode(ExternalEncoding))
        if self.storage_area is not None:
            showIndent(outfile, level)
            outfile.write('storage_area=%s,\n' % quote_python(self.storage_area).encode(ExternalEncoding))
        if self.serialisationFlags is not None:
            showIndent(outfile, level)
            outfile.write('serialisationFlags=model_.SerialisationFlags(\n')
            self.serialisationFlags.exportLiteral(outfile, level, name_='serialisationFlags')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.externs is not None:
            showIndent(outfile, level)
            outfile.write('externs=model_.Externs(\n')
            self.externs.exportLiteral(outfile, level, name_='externs')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.load_callback is not None:
            showIndent(outfile, level)
            outfile.write('load_callback=%s,\n' % quote_python(self.load_callback).encode(ExternalEncoding))
        if self.in_mavlink_parameters is not None:
            showIndent(outfile, level)
            outfile.write('in_mavlink_parameters=%s,\n' % self.in_mavlink_parameters)
        if self.parameters is not None:
            showIndent(outfile, level)
            outfile.write('parameters=model_.Parameters(\n')
            self.parameters.exportLiteral(outfile, level, name_='parameters')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.description is not None:
            showIndent(outfile, level)
            outfile.write('description=%s,\n' % quote_python(self.description).encode(ExternalEncoding))
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'blockName':
            blockName_ = child_.text
            blockName_ = self.gds_validate_string(blockName_, node, 'blockName')
            self.blockName = blockName_
        elif nodeName_ == 'storage_area':
            storage_area_ = child_.text
            storage_area_ = self.gds_validate_string(storage_area_, node, 'storage_area')
            self.storage_area = storage_area_
        elif nodeName_ == 'serialisationFlags':
            obj_ = SerialisationFlags.factory()
            obj_.build(child_)
            self.set_serialisationFlags(obj_)
        elif nodeName_ == 'externs':
            obj_ = Externs.factory()
            obj_.build(child_)
            self.set_externs(obj_)
        elif nodeName_ == 'load_callback':
            load_callback_ = child_.text
            load_callback_ = self.gds_validate_string(load_callback_, node, 'load_callback')
            self.load_callback = load_callback_
        elif nodeName_ == 'in_mavlink_parameters':
            sval_ = child_.text
            if sval_ in ('true', '1'):
                ival_ = True
            elif sval_ in ('false', '0'):
                ival_ = False
            else:
                raise_parse_error(child_, 'requires boolean')
            ival_ = self.gds_validate_boolean(ival_, node, 'in_mavlink_parameters')
            self.in_mavlink_parameters = ival_
        elif nodeName_ == 'parameters':
            obj_ = Parameters.factory()
            obj_.build(child_)
            self.set_parameters(obj_)
        elif nodeName_ == 'description':
            description_ = child_.text
            description_ = self.gds_validate_string(description_, node, 'description')
            self.description = description_
# end class ParameterBlock


class ParameterBlocks(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, parameterBlock=None):
        if parameterBlock is None:
            self.parameterBlock = []
        else:
            self.parameterBlock = parameterBlock
    def factory(*args_, **kwargs_):
        if ParameterBlocks.subclass:
            return ParameterBlocks.subclass(*args_, **kwargs_)
        else:
            return ParameterBlocks(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_parameterBlock(self): return self.parameterBlock
    def set_parameterBlock(self, parameterBlock): self.parameterBlock = parameterBlock
    def add_parameterBlock(self, value): self.parameterBlock.append(value)
    def insert_parameterBlock(self, index, value): self.parameterBlock[index] = value
    def export(self, outfile, level, namespace_='', name_='ParameterBlocks', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='ParameterBlocks')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ParameterBlocks'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='ParameterBlocks', fromsubclass_=False):
        for parameterBlock_ in self.parameterBlock:
            parameterBlock_.export(outfile, level, namespace_, name_='parameterBlock')
    def hasContent_(self):
        if (
            self.parameterBlock
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='ParameterBlocks'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('parameterBlock=[\n')
        level += 1
        for parameterBlock_ in self.parameterBlock:
            showIndent(outfile, level)
            outfile.write('model_.ParameterBlock(\n')
            parameterBlock_.exportLiteral(outfile, level, name_='ParameterBlock')
            showIndent(outfile, level)
            outfile.write('),\n')
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'parameterBlock':
            obj_ = ParameterBlock.factory()
            obj_.build(child_)
            self.parameterBlock.append(obj_)
# end class ParameterBlocks


class ParameterDatabase(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, dataStorageAreas=None, serialisationFlags=None, udbTypes=None, parameterBlocks=None):
        self.dataStorageAreas = dataStorageAreas
        self.serialisationFlags = serialisationFlags
        self.udbTypes = udbTypes
        self.parameterBlocks = parameterBlocks
    def factory(*args_, **kwargs_):
        if ParameterDatabase.subclass:
            return ParameterDatabase.subclass(*args_, **kwargs_)
        else:
            return ParameterDatabase(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_dataStorageAreas(self): return self.dataStorageAreas
    def set_dataStorageAreas(self, dataStorageAreas): self.dataStorageAreas = dataStorageAreas
    def get_serialisationFlags(self): return self.serialisationFlags
    def set_serialisationFlags(self, serialisationFlags): self.serialisationFlags = serialisationFlags
    def get_udbTypes(self): return self.udbTypes
    def set_udbTypes(self, udbTypes): self.udbTypes = udbTypes
    def get_parameterBlocks(self): return self.parameterBlocks
    def set_parameterBlocks(self, parameterBlocks): self.parameterBlocks = parameterBlocks
    def export(self, outfile, level, namespace_='', name_='ParameterDatabase', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='ParameterDatabase')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='ParameterDatabase'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='ParameterDatabase', fromsubclass_=False):
        if self.dataStorageAreas is not None:
            self.dataStorageAreas.export(outfile, level, namespace_, name_='dataStorageAreas', )
        if self.serialisationFlags is not None:
            self.serialisationFlags.export(outfile, level, namespace_, name_='serialisationFlags', )
        if self.udbTypes is not None:
            self.udbTypes.export(outfile, level, namespace_, name_='udbTypes', )
        if self.parameterBlocks is not None:
            self.parameterBlocks.export(outfile, level, namespace_, name_='parameterBlocks', )
    def hasContent_(self):
        if (
            self.dataStorageAreas is not None or
            self.serialisationFlags is not None or
            self.udbTypes is not None or
            self.parameterBlocks is not None
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='ParameterDatabase'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        if self.dataStorageAreas is not None:
            showIndent(outfile, level)
            outfile.write('dataStorageAreas=model_.DataStorageAreas(\n')
            self.dataStorageAreas.exportLiteral(outfile, level, name_='dataStorageAreas')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.serialisationFlags is not None:
            showIndent(outfile, level)
            outfile.write('serialisationFlags=model_.SerialisationFlags(\n')
            self.serialisationFlags.exportLiteral(outfile, level, name_='serialisationFlags')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.udbTypes is not None:
            showIndent(outfile, level)
            outfile.write('udbTypes=model_.UDBTypes(\n')
            self.udbTypes.exportLiteral(outfile, level, name_='udbTypes')
            showIndent(outfile, level)
            outfile.write('),\n')
        if self.parameterBlocks is not None:
            showIndent(outfile, level)
            outfile.write('parameterBlocks=model_.ParameterBlocks(\n')
            self.parameterBlocks.exportLiteral(outfile, level, name_='parameterBlocks')
            showIndent(outfile, level)
            outfile.write('),\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'dataStorageAreas':
            obj_ = DataStorageAreas.factory()
            obj_.build(child_)
            self.set_dataStorageAreas(obj_)
        elif nodeName_ == 'serialisationFlags':
            obj_ = SerialisationFlags.factory()
            obj_.build(child_)
            self.set_serialisationFlags(obj_)
        elif nodeName_ == 'udbTypes':
            obj_ = UDBTypes.factory()
            obj_.build(child_)
            self.set_udbTypes(obj_)
        elif nodeName_ == 'parameterBlocks':
            obj_ = ParameterBlocks.factory()
            obj_.build(child_)
            self.set_parameterBlocks(obj_)
# end class ParameterDatabase


class Externs(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, externString=None):
        if externString is None:
            self.externString = []
        else:
            self.externString = externString
    def factory(*args_, **kwargs_):
        if Externs.subclass:
            return Externs.subclass(*args_, **kwargs_)
        else:
            return Externs(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_externString(self): return self.externString
    def set_externString(self, externString): self.externString = externString
    def add_externString(self, value): self.externString.append(value)
    def insert_externString(self, index, value): self.externString[index] = value
    def export(self, outfile, level, namespace_='', name_='Externs', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='Externs')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='Externs'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='Externs', fromsubclass_=False):
        for externString_ in self.externString:
            showIndent(outfile, level)
            outfile.write('<%sexternString>%s</%sexternString>\n' % (namespace_, self.gds_format_string(quote_xml(externString_).encode(ExternalEncoding), input_name='externString'), namespace_))
    def hasContent_(self):
        if (
            self.externString
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='Externs'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('externString=[\n')
        level += 1
        for externString_ in self.externString:
            showIndent(outfile, level)
            outfile.write('%s,\n' % quote_python(externString_).encode(ExternalEncoding))
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'externString':
            externString_ = child_.text
            externString_ = self.gds_validate_string(externString_, node, 'externString')
            self.externString.append(externString_)
# end class Externs


class DataStorageAreas(GeneratedsSuper):
    subclass = None
    superclass = None
    def __init__(self, dataStorageArea=None):
        if dataStorageArea is None:
            self.dataStorageArea = []
        else:
            self.dataStorageArea = dataStorageArea
    def factory(*args_, **kwargs_):
        if DataStorageAreas.subclass:
            return DataStorageAreas.subclass(*args_, **kwargs_)
        else:
            return DataStorageAreas(*args_, **kwargs_)
    factory = staticmethod(factory)
    def get_dataStorageArea(self): return self.dataStorageArea
    def set_dataStorageArea(self, dataStorageArea): self.dataStorageArea = dataStorageArea
    def add_dataStorageArea(self, value): self.dataStorageArea.append(value)
    def insert_dataStorageArea(self, index, value): self.dataStorageArea[index] = value
    def export(self, outfile, level, namespace_='', name_='DataStorageAreas', namespacedef_=''):
        showIndent(outfile, level)
        outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
        already_processed = []
        self.exportAttributes(outfile, level, already_processed, namespace_, name_='DataStorageAreas')
        if self.hasContent_():
            outfile.write('>\n')
            self.exportChildren(outfile, level + 1, namespace_, name_)
            showIndent(outfile, level)
            outfile.write('</%s%s>\n' % (namespace_, name_))
        else:
            outfile.write('/>\n')
    def exportAttributes(self, outfile, level, already_processed, namespace_='', name_='DataStorageAreas'):
        pass
    def exportChildren(self, outfile, level, namespace_='', name_='DataStorageAreas', fromsubclass_=False):
        for dataStorageArea_ in self.dataStorageArea:
            showIndent(outfile, level)
            outfile.write('<%sdataStorageArea>%s</%sdataStorageArea>\n' % (namespace_, self.gds_format_string(quote_xml(dataStorageArea_).encode(ExternalEncoding), input_name='dataStorageArea'), namespace_))
    def hasContent_(self):
        if (
            self.dataStorageArea
            ):
            return True
        else:
            return False
    def exportLiteral(self, outfile, level, name_='DataStorageAreas'):
        level += 1
        self.exportLiteralAttributes(outfile, level, [], name_)
        if self.hasContent_():
            self.exportLiteralChildren(outfile, level, name_)
    def exportLiteralAttributes(self, outfile, level, already_processed, name_):
        pass
    def exportLiteralChildren(self, outfile, level, name_):
        showIndent(outfile, level)
        outfile.write('dataStorageArea=[\n')
        level += 1
        for dataStorageArea_ in self.dataStorageArea:
            showIndent(outfile, level)
            outfile.write('%s,\n' % quote_python(dataStorageArea_).encode(ExternalEncoding))
        level -= 1
        showIndent(outfile, level)
        outfile.write('],\n')
    def build(self, node):
        self.buildAttributes(node, node.attrib, [])
        for child in node:
            nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]
            self.buildChildren(child, node, nodeName_)
    def buildAttributes(self, node, attrs, already_processed):
        pass
    def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
        if nodeName_ == 'dataStorageArea':
            dataStorageArea_ = child_.text
            dataStorageArea_ = self.gds_validate_string(dataStorageArea_, node, 'dataStorageArea')
            self.dataStorageArea.append(dataStorageArea_)
# end class DataStorageAreas


USAGE_TEXT = """
Usage: python <Parser>.py [ -s ] <in_xml_file>
"""

def usage():
    print USAGE_TEXT
    sys.exit(1)


def get_root_tag(node):
    tag = Tag_pattern_.match(node.tag).groups()[-1]
    rootClass = globals().get(tag)
    return tag, rootClass


def parse(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'ParameterDatabase'
        rootClass = ParameterDatabase
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_=rootTag, 
        namespacedef_='')
    return rootObj


def parseString(inString):
    from StringIO import StringIO
    doc = parsexml_(StringIO(inString))
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'ParameterDatabase'
        rootClass = ParameterDatabase
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('<?xml version="1.0" ?>\n')
    rootObj.export(sys.stdout, 0, name_="ParameterDatabase",
        namespacedef_='')
    return rootObj


def parseLiteral(inFileName):
    doc = parsexml_(inFileName)
    rootNode = doc.getroot()
    rootTag, rootClass = get_root_tag(rootNode)
    if rootClass is None:
        rootTag = 'ParameterDatabase'
        rootClass = ParameterDatabase
    rootObj = rootClass.factory()
    rootObj.build(rootNode)
    # Enable Python to collect the space used by the DOM.
    doc = None
    sys.stdout.write('#from ParameterDatabase import *\n\n')
    sys.stdout.write('import ParameterDatabase as model_\n\n')
    sys.stdout.write('rootObj = model_.rootTag(\n')
    rootObj.exportLiteral(sys.stdout, 0, name_=rootTag)
    sys.stdout.write(')\n')
    return rootObj


def main():
    args = sys.argv[1:]
    if len(args) == 1:
        parse(args[0])
    else:
        usage()


if __name__ == '__main__':
    #import pdb; pdb.set_trace()
    main()


__all__ = [
    "DataStorageAreas",
    "Externs",
    "Parameter",
    "ParameterBlock",
    "ParameterBlocks",
    "ParameterDatabase",
    "Parameters",
    "SerialisationFlags",
    "UDBType",
    "UDBTypes"
    ]
